﻿namespace Netbits.Common.General.CommandLine
{
	/// <summary>
	/// Represent the base class for a command-line argument.
	/// </summary>
	/// <typeparam name="TArgumentType">Type of the argument value</typeparam>
	public abstract class ArgumentBase<TArgumentType> : IArgument
	{
		#region Private Variables

		/// <summary>
		/// Default argument value 
		/// </summary>
		protected TArgumentType _DefaultValue;
		/// <summary>
		/// Argument value
		/// </summary>
		protected TArgumentType _Value;
		/// <summary>
		/// Short-Name of this argument
		/// </summary>
		protected string _ShortName;
		/// <summary>
		/// Long-Name of this argument
		/// </summary>
		protected string _LongName;
		/// <summary>
		/// Description of this argument
		/// </summary>
		protected string _Description;
		/// <summary>
		/// Is this argument set
		/// </summary>
		protected bool _IsSet;
		/// <summary>
		/// Is default-value set for this argument
		/// </summary>
		protected bool _IsDefaultSet;
		/// <summary>
		/// Is this argument required
		/// </summary>
		protected bool _Required;

		#endregion

		#region Constructor

		/// <summary>
		/// Create new instance of the argument-base class
		/// </summary>
		/// <param name="ShortName_">Name of the argument</param>
		public ArgumentBase( string ShortName_ )
		{
			_ShortName = ShortName_;
		}

		#endregion

		#region Public Properties

		/// <summary>
		/// Return the short name of the argument.
		/// </summary>
		public string ShortName
		{
			get	{ return _ShortName; }
			private set { _ShortName = value; }
		}

		/// <summary>
		/// Return the long name of the argument or set this.
		/// </summary>
		public string LongName
		{
			get	{ return _LongName;	}
			set { _LongName = value; }
		}

		/// <summary>
		/// Return the description of the argument or set this.
		/// </summary>
		public string Description
		{
			get { return _Description; }
			set { _Description = value; }
		}

		/// <summary>
		/// Return if this argument is set
		/// </summary>
		public bool IsSet
		{
			get { return _IsSet; }
			protected set { _IsSet = value; }
		}

		/// <summary>
		/// Return if the default value for this argument is set
		/// </summary>
		public bool IsDefaultSet
		{
			get { return _IsDefaultSet; }
			private set { _IsDefaultSet = value; }
		}

		/// <summary>
		/// Returns the default-value for this argument or set this
		/// </summary>
		public TArgumentType DefaultValue
		{
			get { return _DefaultValue;	}
			set
			{
				IsDefaultSet = true;
				_DefaultValue = value;
			}
		}

		/// <summary>
		/// Returns the value for this argument or set this.
		/// </summary>
		public TArgumentType Value
		{
			get { return _Value; }
			set { _Value = value; }
		}

		/// <summary>
		/// Return if this argument is required or set this
		/// </summary>
		public bool Required
		{
			get { return _Required; }
			set { _Required = value; }
		}

		#endregion

		#region Public Functions

		/// <summary>
		/// Parse the specified value to this argument instance
		/// </summary>
		/// <param name="Value_">Value to parse</param>
		public virtual void Parse( string Value_ )
		{
			throw new System.NotImplementedException();
		}

		#endregion
	}
}
